﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using Desktop.Media.Encoder;

namespace Deskop.Media.Encoder.Tester
{
    
    class Program
    {
      
        static void Main(string[] args)
        {
            var encoder = new WindowsMediaEncoder();

            encoder.OutputFilename = @"c:\users\public\videos\my_video2.wmv";
            encoder.EncodingProfileData = File.ReadAllText(@"C:\Users\jmoney\Desktop\profile.prx");
            encoder.InitializeVideo(320,240,32);
            encoder.InitializeAudio(2,16, 44100);
            encoder.BeginWriting();

            for (int i = 0; i < 1000; i++)
            {
                var frame = new byte[320*240*4];

                for(int j = 0; j < i * 200; j++)
                {
                    frame[j] = 255;
                }
                encoder.AppendVideoSampleBuffer(frame, i * 1000000);
                //encoder.AppendAudioSample(new byte[2 * 2 * 44100]);
                //Thread.Sleep(33);
                Debug.WriteLine(i);
            }
            

            encoder.Close();
        }
    }
}
